Skip to content

feat(engine): secret redaction mode, superseded detail, delta recall, and enhanced auto routing - #187

Merged
Coding-Dev-Tools merged 6 commits into
mainfrom
feat/engine-enhancements
Sep 3, 2026
Merged

feat(engine): secret redaction mode, superseded detail, delta recall, and enhanced auto routing#187
Coding-Dev-Tools merged 6 commits into
mainfrom
feat/engine-enhancements

Conversation

@Coding-Dev-Tools

Copy link
Copy Markdown
Owner

Overview

This PR delivers four high-impact, backward-compatible engine enhancements across the Engraphis v2 core and service facade:

  1. Secret & Credential Redaction Mode (
    edact_secrets)
    :

    • Opt-in
      edact_secrets: bool = False\ on \MemoryEngine.remember(),
      emember_with_resolution(), and \MemoryService.remember().
    • Safely sanitizes detected API keys, tokens, and private credentials into <redacted>\ markers before validation/storage, preventing agent tool turns from failing unexpectedly on raw logs.
    • Tested in \ ests/test_secret_hygiene.py.
  2. Superseded Detail in Write Resolution (\superseded_detail):

    • \INVALIDATE\ resolutions return \superseded_detail\ containing predecessor ID, content preview, prior stability (Ebbinghaus S), and access count.
    • Tested in \ ests/test_release_write_path.py.
  3. Incremental Delta Recall (\modified_since):

    • Adds \modified_since: Optional[float] = None\ to \SearchFilter.
    • Filters memory reads to \ingested_at >= ?\ in both SQL query builder and \memory_matches_filter().
    • Enables agents to stream delta context between turns rather than re-fetching full snapshots.
    • Tested in \ ests/test_bitemporal_recall.py.
  4. Enhanced Dynamic Intent Routing in Auto Profile:

    • Expands _GRAPH_RE\ to capture \connected, \connections, \superseded, and \supersedes.
    • Expands _CODE_RE\ to recognize \interface\ and \struct\ definitions.
    • Tested in \ ests/test_retrieval_policy.py.

Validation

  • All 12 primary offline CI gates pass (
    uff, \pyright, \pytest, \check_commercial_manifest.py, CSP drift, and all 7 eval gates).

…all, and enhanced auto routing

- Secret redaction mode: opt-in redact_secrets flag in MemoryEngine.remember and MemoryService.remember masks detected credentials safely to <redacted> instead of failing agent writes.
- Superseded detail: invalidation write resolution returns superseded_detail (id, content_preview, prior stability_days, prior access_count).
- Delta recall: SearchFilter.modified_since enables streaming incremental recall (ingested_at >= ?) to minimize agent token usage.
- Enhanced auto routing: DeterministicRetrievalPolicy recognizes structural/relationship tokens ('connected', 'superseded') and definitions ('interface', 'struct').
- Full test coverage across all 4 capabilities, all 12 CI gates verified green.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

… parser to eliminate CodeQL polynomial ReDoS

- Replaces _PEM_BLOCK regex in redact_secrets with an O(N) linear-time str.find scanner _redact_pem.
- Eliminates the py/polynomial-redos CodeQL static analysis vulnerability caused by backtracking over repeated PEM headers.
- Adds test coverage verifying linear execution time on repeated PEM headers in tests/test_secrets_edge_cases.py.
…nner in _PATTERNS

- Replaces regex-based PEM header search in _PATTERNS with linear _contains_pem_header and _PEMHeaderPattern.
- Ensures safe initialization in redact_secrets and provides ReDoS execution time test.
CodeQL's polynomial-ReDoS gate (py/polynomial-redos) flags the
'-----BEGIN PRIVATE KEY' detection regex: the optional ' [A-Z0-9]+' group
makes worst-case matching input-dependent. Replace it with a
case-normalized anchor scan using monotone-cached str.find probes for
both the canonical header and the '-----BEGIN <kind> ' variant
(RSA/EC/DSA/OPENSSH/ENCRYPTED/PGP/PKCS8), verified O(N) on adversarial
shapes (anchor-heavy 3MB: 0.92s; long-token 2MB: 0.24s; late-header
1.5MB: 0.09s) with identical accept/reject behavior across PEM variants
and no change to reject_secrets/redact_secrets contracts.
@Coding-Dev-Tools
Coding-Dev-Tools merged commit d83b324 into main Sep 3, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant